<template>
	<view  v-if="visible" class="modal-overlay">
		<view class="content-input">
		<view class="head"> <span class="head-title">指派分单</span></view>
		<view class="avatar-info1">
			<input type="text"
			  placeholder="请输入关键字"
			  v-model="inputValue"
			  class="contact-info1"
			  @input="onInput">
			  </input>
		</view>
		<div v-for="(item, index) in items" :key="index"  >
		<view class="content-item">
			<p class="content-item-list" @click="selectName(item,index)">
				<span><image src="../../../static/人物.png" style="width: 15px; height: 15px;position: relative;top: 2px;border-radius: 5px;"></image></span>
				<span class="item-name">{{item.name}}</span>
				<span class="item-phone">{{item.phone}}</span>
			</p>
		</view>
		</div>
		<view class="model-footer">
			<button class="footer-button" @click="closeShow">取消</button>
		</view>
		</view>
		<Toast ref="toast" @add-item="handleIsItem" :name="name" :phone="phone" :businessId="businessId"/>
	</view>
</template>

<script>
	import {getSon} from '@/api/bill.js';
	import Toast from '@/pages/components/ToastBill/ToastBill.vue';
	export default {
		components: {
			Toast
		 },
		 props: {
		 	 businessId: {
				 type: Number,
				 required: true
			 },
		     },
		data() {
			return {
				visible: false,
				title: '指派分单',
				items:[
				],
				name:'',
				phone:''
			}
		},
		mounted(){
		},
		methods: {
			handleIsItem(){
				this.$emit('add-item', 1);
				this.visible=false;
			},
			showModal(title, callback,userId) {
			  this.title = title;
			  this.callback = callback;
			  this.visible = true;
			  this.userId=userId;
			  getSon({subaccountId:this.userId}).then(res =>{
			  	this.items=res.data.data
			  });
			  // 可以在这里重置 inputValue，如果需要的话
			  // this.periodValue='';
			  // this.textareaContent='';
			  // this.inputValue = '';
			  // this.dtoList={};
			  // this.req.dtoTS=[{}]
			},
			selectName(item,index){
				console.log(this.businessId);
				this.name=this.items[index].name;
				this.phone=this.items[index].phone;
				this.$refs.toast.show('提示');
			},
			closeShow(){
					  this.visible = false;
			},
		}
	}
</script>

<style>
@import "BillModal.css";
</style>
